# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        潘炎珍  
# Name:         demo05
# Description:
# Author:       98745
# Date:         2019/3/10
#-------------------------------------------------------------------------------

import json
class product:
    def __init__(self,d):
        self.__dict__=d
f=open('files/product.json','r',encoding='utf-8')
js=f.read()
my1=json.loads(js,object_hook=product)
print('name','=',my1.name)
print('price','=',my1.price)
print('count','=',my1.count)

print('-----------')
def jp(d):
    return product(d)
my2=json.loads(js,object_hook=jp)
print('name','=',my2.name)
print('price','=',my2.price)
print('count','=',my2.count)
f.close()
